package com.imooc.cls1;


import com.imooc.cls1.car.Audi;
import com.imooc.cls1.car.Buick;
import com.imooc.cls1.human.Jerry;
import com.imooc.cls1.human.Tom;
import org.junit.Before;
import org.junit.Test;

public class ClassDemo1 {
    private IoCContainer ioCContainer;

    @Before
    public void before(){
        System.out.println("before");
        ioCContainer=new IoCContainer();
        ioCContainer.setBean(Audi.class,"audi");
        ioCContainer.setBean(Buick.class,"buick");
        ioCContainer.setBean(Tom.class,"tom","audi");
        ioCContainer.setBean(Jerry.class,"jerry","buick");
    }

    @Test
    public void test(){
        Tom tom=(Tom)ioCContainer.getBean("tom");
        tom.goHome();
        System.out.println("=============================");
        Jerry jerry=(Jerry)ioCContainer.getBean("jerry");
        jerry.goHome();
    }
}
